package ch9_9_3;
public class CheckingAccount extends Account{
	private double overdraftLimit;
	
	/** construct a default CheckingAccount object */
	protected CheckingAccount(){
		overdraftLimit=0.0;
	}
	
	/** withdraw a specific amount from account as long as it has not been overdrawn */
	public void withDraw(double withDrawAmount){
		double balance=this.getBalance();
		if((balance-withDrawAmount) < overdraftLimit){
			balance -= withDrawAmount;
			this.setBalance(balance);			
		}
		else
			System.out.println("you cannot withdraw "+withDrawAmount);
	}
	
	/** return a string representation of this object */
	public String toString(){
		return "CheckingAccount: created on "+this.getDateCreated()+
				",id="+this.getID()+",balance="+this.getBalance()+
				",annualInterestRate="+this.getAnnualInterestRate()+".";
	}
}